package com.xywy.me;

import java.io.File;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.Window;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.xywy.R;
import com.xywy.common.BaseActivity;
import com.xywy.common.util.FileUtil;
import com.xywy.common.widget.TitleBar2;
import com.xywy.me.bean.User;

/**
 * 我 - 设置 首页
 * 
 * @author xiaogd
 * 
 */
public class SetupActivity extends BaseActivity implements View.OnClickListener {
	private static final String TAG = "SetupActivity";
	private Context mContext;
	private User current_user;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 设置为全屏
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.me_setup);

		this.preInit();
		this.initView();
		this.loadData();
	}

	public void onClcikSetUp(View view) {
		Class cl = null;
		switch (view.getId()) {
		case R.id.rl_me_setup_account:
			cl = SetupAccountActivity.class;
			break;
		case R.id.rl_me_setup_push:
			cl  = SetupPushActivity.class;
			break;
		case R.id.rl_me_setup_clear:
			String fileStr = Environment.getExternalStorageDirectory()+FileUtil.split;
			File file = new File(fileStr);
			FileUtil.clear(file);
			Toast.makeText(SetupActivity.this, getString(R.string.me_setup_clear_toast),
					Toast.LENGTH_SHORT).show();
			break;
		case R.id.rl_me_setup_about:
			cl = SetupAboutActivity.class;
			break;
		}
		;
		if (cl != null) {
			Intent intent = new Intent(SetupActivity.this, cl);
			startActivity(intent);
		}
	}

	@Override
	protected void onResume() {
		super.onResume();

	}

	@Override
	protected void onPause() {
		super.onPause();

	}

	@Override
	public void preInit() {
		mContext = this.context;
	}

	@Override
	public void loadData() {

	}

	@Override
	public void initView() {
		// title
		TitleBar2 titleBar = (TitleBar2) findViewById(R.id.me_setup_title_bar);
		titleBar.onClickBack(this);
		TextView tvTitle = titleBar.getTitle();
		TextView tvBack = titleBar.getTvBack();
		titleBar.getGo().setVisibility(View.INVISIBLE);
		tvTitle.setText(getString(R.string.me_setup_title));
		tvBack.setText(getString(R.string.me_infor_back));

		// RelativeLayout rlAccount =
		// (RelativeLayout)findViewById(R.id.rl_me_setup_account);
		// RelativeLayout rlpush =
		// (RelativeLayout)findViewById(R.id.rl_me_setup_push);
		// RelativeLayout rlClear =
		// (RelativeLayout)findViewById(R.id.rl_me_setup_clear);
		// RelativeLayout rlabout =
		// (RelativeLayout)findViewById(R.id.rl_me_setup_about);

		// rlAccount.setBackgroundColor(mContext.getResources().getColor(R.color.white));
		// rlpush.setBackgroundColor(mContext.getResources().getColor(R.color.white));
		// rlClear.setBackgroundColor(mContext.getResources().getColor(R.color.white));
		// rlabout.setBackgroundColor(mContext.getResources().getColor(R.color.white));
	}

	@Override
	public void onClick(View view) {

	}
}
